package business;
/* An interpreter for the simple math language we all espouse. */

import java.io.IOException;
import java.util.LinkedList;

import node.AAspectnetlogocompiler;
import node.PAspect;
import run.Compiler;
import analysis.DepthFirstAdapter;

public class Interpreter extends DepthFirstAdapter { 

	/**
	 * If the program.an file has a AspectNetLogo code, this method will
	 * be executed. Its create a AspectFile with a list of aspects and puts on Weaver.
	 * 
	 * @param node
	 */
	public void caseAAspectnetlogocompiler(AAspectnetlogocompiler node) { 
		
		/* Gets a aspect list. */ 
		LinkedList<PAspect> aspects = node.getAspect();
		
		try{
			/* Create and set the weaver fields. */
			Compiler.createWeaver(new AspectFile(aspects));
		}catch (IOException e) {
			e.printStackTrace();
		}
	} 
}